package org.guegan.util.dircompare.main;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.guegan.util.dircompare.bean.DirBean;
import org.guegan.util.dircompare.bean.FileBean;
import org.hibernate.Query;

public class DeletedFinder extends MainModule {
	private static Log log = LogFactory.getLog(DeletedFinder.class);
	
	public DeletedFinder() {
	}
	
	public void doExecute() {
		Query query = getSession().getNamedQuery("DirBean.deleted");
		log.debug("Going to run query" + query.getQueryString());
		List<DirBean> res = getSessionUtil().list(query);
		for (DirBean dirBean : res) {
			report("Directory " + dirBean.toString() + " has been deleted/ignored", log);
		}
		query = getSession().getNamedQuery("FileBean.deleted-alone");
		log.debug("Going to run query" + query.getQueryString());
		List<FileBean> res2 = getSessionUtil().list(query);
		for (FileBean fileBean : res2) {
			report("File      " + fileBean.toString() + " has been deleted/ignored", log);
		}
	}
	
	
}
